package cn.jinjimi.app.main.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import cn.jinjimi.app.R;
import cn.jinjimi.app.entity.Province;
import cn.jinjimi.app.main.adapter.extend.MyBaseAdapter;

/**
 * Created by Roy
 * Date: 16/7/18
 */
public class ProvinceAdapter extends MyBaseAdapter<Province> {
    private Context mContext;

    public ProvinceAdapter(Context context) {
        mContext = context;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {

        Holder holder;

        if (convertView == null) {
            convertView = View.inflate(mContext, R.layout.item_area_or_group, null);
            holder = new Holder(convertView);
            convertView.setTag(holder);
        } else {
            holder = (Holder) convertView.getTag();
        }

        Province item = getItem(position);
        holder.tvName.setText(item.provinceName);

        return convertView;
    }

    public class Holder {
        public TextView tvName;

        public Holder(View view) {
            tvName = (TextView) view.findViewById(R.id.area_province);
        }
    }
}
